<template>
    <h3>用户登录</h3>
    <table>
        <tr>
            <td>账号：</td>
            <td><input type="text" v-model="UName"></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" v-model="UPwd"></td>
        </tr>
        <tr>
            <td><button @click="login">登录</button></td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import axios from 'axios'
const UName = ref("")
const UPwd = ref("")

const login = () => {
    axios.get('http://localhost:58898/api/Users/Login', {
        params: {
            UName: UName.value,
            UPwd: UPwd.value
        }
    })
    if (UName.value == "") {
        alert('用户名不能为空')
        return;
    }
    if (UPwd.value == "") {
        alert('密码不能为空')
        return;
    }
}
</script>